

#ifndef __CE_PHYSICS_H__
#define __CE_PHYSICS_H__

#include <cegfx/ceexport.h>
#include <d3dx9.h>
#include <btBulletCollisionCommon.h>
#include <btBulletDynamicsCommon.h>
#include <cegfx/iqf.h>

class ceNode;
class CE_GFX_API cePhysics : public virtual iBase
{
	IQF_DECLARATION;
private:
	btCollisionConfiguration*	config;
	btDispatcher*	dispatcher;
	btBroadphaseInterface* broadphase;
	btConstraintSolver* solver;
	btDynamicsWorld* world;
public:
	cePhysics ();
	~cePhysics ();

	void Initialize (const D3DXVECTOR3& gravity = D3DXVECTOR3(0.0f, -9.81f, 0.0f));

	void Step (float time = 1.0f / 60.0f);


	btRigidBody* AddStatic (btCollisionShape* shape, 
													const D3DXVECTOR3& position = D3DXVECTOR3(0.0f, 0.0f, 0.0f), 
													float angle									= 0.0f, 
													const D3DXVECTOR3& axis			= D3DXVECTOR3(0.0f, 1.0f, 0.0f));

	btRigidBody* AddDynamic (btCollisionShape*  shape, 
													 ceNode*						node,
													 float							mass = 1.0f);
};

#endif
